// pages/vue/vue.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    ishis: false, //用户回复是否弹出键盘
    isSubmit: false, //键盘输入触发“发送”按钮变色
    valueName:"",
    item:[
      {
        id:111111111111,
        name:"曾经最美",
        info:"看起来很棒，味道怎么样？",
        user:"",
        isuser: false,
      },{
        id:222222222222,
        name: "艾莉森",
        info: "太难吃了？",
        user:"",
        isuser: false,
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  //键盘输入是触发按钮
  oNbindinputTap: function (e) {
    var valueName = e.detail.value;
    if (valueName.length == 0) {
      this.data.isSubmit = false;
    } else {
      this.data.isSubmit = true;
    }
    this.setData({
      isSubmit: this.data.isSubmit,
      valueName: valueName
    })
    
  },

  //点击不同用户回复信息
  onchangeTap: function (e) {
    var beiname = e.currentTarget.dataset.beiname;
    this.setData({
      ishis: true,
      beiname: beiname
    })
  },

  formSubmit:function(e){
    var name="妮妮";
    this.data.item.push({
      id: "",
      name: this.data.beiname ,
      info: this.data.valueName,
      user:name,
      isuser: true,
    });

    this.setData({
      item:this.data.item,
      isSubmit:false,
      valueName:""
    })
    console.log(name + "回复" + this.data.beiname + ":" + this.data.valueName);
    console.log(this.data.item.length);
  
  }
})